import * as types from './mutation_types'

// 数字化档案新增json
export const getCategoryFormJson = ({ commit }) => {
  fetch('./newFormJson/categoryType.json?_=' + (new Date())).then((res) => {
  // fetch('./static/categoryType.json?_=' + (new Date())).then((res) => {
    return res.json()
  }).then((data) => {
    commit(types.CATEGORY_FORM_SET_RETRIEVED, data)
  }).catch(() => {
    commit(types.CATEGORY_FORM_SET_RETRIEVED, null)
  })
}

// 电子文件新增json
export const getFileFormJson = ({ commit }) => {
  fetch('./newFormJson/dianziwenjian.json?_=' + (new Date())).then((res) => {
    return res.json()
  }).then((data) => {
    commit(types.CATEGORY_FORM_SET_DZFILE, data)
  }).catch(() => {
    commit(types.CATEGORY_FORM_SET_DZFILE, null)
  })
}

// 电子文件整理json
export const getFileZlForm = ({ commit }) => {
  fetch('./newFormJson/filezhengli.json?_=' + (new Date())).then((res) => {
    return res.json()
  }).then((data) => {
    commit(types.CATEGORY_FORM_SET_DZFILEZL, data)
  }).catch(() => {
    commit(types.CATEGORY_FORM_SET_DZFILEZL, null)
  })
}
